package com.campus.commons.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;

/**
 * <p>
 * 问题反馈
 * </p>
 *
 * @author Rin
 * @since 2020-12-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Feedback对象", description="问题反馈")
public class Feedback implements Serializable {

    public static final int State_Complete=1;
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "用户Id")
    @TableField("userId")
    @NotNull
    private Integer userid;

    @ApiModelProperty(value = "反馈内容")
    @Size(min = 5,max = 300,message = "反馈内容不符合要求，要求(最短五个字符，最长300个字符)")
    private String content;

    @ApiModelProperty(value = "反馈时间")
    @TableField("createTime")
    private Date createtime;

    @ApiModelProperty(value = "照片")
    private String image;

    @ApiModelProperty(value = "反馈类型Id")
    @TableField("feedTypeId")
    @Min(value = 1,message = "反馈类型错误")
    private Integer feedTypeId;

    @ApiModelProperty(value = "反馈状态")
    @TableField("state")
    @Size(max = 1,min = -1,message = "反馈状态不正确")
    private Integer state;

    //获取类型
    public void setFeedTypeId(Integer feedTypeId) {
        this.feedTypeId = feedTypeId;
        this.feedType = FeedType.feeds.get(feedTypeId);
    }

    @ApiModelProperty(value = "反馈类型")
    @TableField(exist = false)
    private FeedType feedType;


}
